<html lang="en">
<head>
    <base href="${title}/">
    <meta charset="UTF-8">
    <link rel="stylesheet" href="/ant-design/antd.min.css">

</head>

<style>
    .disable {
        pointer-events: none;
    }
</style>

<body>
<div>
    <div class="ant-modal-content"><!---->
        <div class="ant-modal-body ng-star-inserted"><!---->
            <erupt-edit-type _nghost-auc-c15="" class="ng-star-inserted">
                <div _ngcontent-auc-c15="" nz-row="" class="ant-row" style="margin-left: -8px; margin-right: -8px;">
                    <form _ngcontent-auc-c15="" novalidate="" nz-form="" se-container=""
                          class="ant-form ant-form-vertical ng-untouched ng-pristine ng-valid">
                        <div class="ant-row se__container se__vertical se__default"
                             style="margin-left: 0px; margin-right: 0px;">
                            <div _ngcontent-auc-c15="" nz-col="" class="ant-col ant-col-24 ng-star-inserted"
                                 style="padding-left: 8px; padding-right: 8px;">
                                <se _ngcontent-auc-c15="" class="ant-form-item se__item"
                                    style="padding-left: 0px; padding-right: 0px;">
                                    <div class="ant-form-item-label">
                                        <label class="se__label ng-star-inserted" for="remark">
                                            <span class="se__label-text">备注</span>
                                        </label>
                                    </div>
                                    <div class="ant-form-item-control-wrapper se__control">
                                        <div class="ant-form-item-control">
                                            <span>
                                            <textarea class="erupt-input ant-input ng-untouched ng-pristine ng-valid"
                                                      rows="1"
                                                      placeholder="请输入备注信息" id="remark"
                                                      style="min-height: 200px; max-height: 430px; height: 200px;"></textarea>
                                            </span>
                                        </div>
                                    </div>
                                </se>
                            </div>
                        </div>
                    </form>
                </div>
            </erupt-edit-type><!----></div><!---->
        <div class="ant-modal-footer ng-star-inserted">
            <button  class="ant-btn ng-star-inserted ant-btn-default" onclick="cancel()">
                <!----><span> 关闭 </span></button><!---->
            <button class="ant-btn ng-star-inserted ant-btn-primary" onclick="update()">
                <!----><span> 确定 </span></button>
        </div>
    </div>


</div>
</body>
<script src="/jquery-3.5.1.min.js"></script>
<script src="/url.js"></script>
<script>
    let url = requestUrl + "/erupt-api/order/remark/get";
    let ids = new URLSearchParams(location.href.split('?')[1]).get("ids")
    $.ajax({
        type: "POST",
        url: url,
        headers: {
            token: parent.getAppToken().token
        },
        data: {orderId: ids},
        datatype: "json",
        success: function (result) {
            console.log(result)
            if (result.code == 1) {
                document.getElementById('remark').innerHTML = result.data
            } else {
                alert(result.msg)
            }
        }
    });


    function cancel() {
        parent.document.querySelector(".ant-modal-close-x").click()
    }

    function update() {
        let remark = $("#remark").val();
        let url = requestUrl + "/erupt-api/order/remark/update";
        $.ajax({
            type: "POST",
            url: url,
            headers: {
                token: parent.getAppToken().token
            },
            data: {
                remark: remark,
                orderId: ids,
            },
            datatype: "json",
            success: function (result) {
                console.log(result)
                if (result.code == 1) {
                    alert('提交成功')
                    parent.document.querySelector(".ant-modal-close-x").click()
                } else {
                    if (result.message != undefined) {
                        alert(result.message)
                    } else if (result.msg != undefined) {
                        alert(result.msg)
                    }
                }
            }
        });
    }

</script>

</html>